function foo(x, y) {
    console.log(this.a);
    return x + y;
  }
  const obj = {
    a: 1
  }
  
  
  Function.prototype.myCall = function (obj,...args) {
    // 将 foo 引用到 obj 上
    // 让 obj 调用foo
    // 移除 obj 上的 foo
    const context = obj
    const arg = args.slice(0)   // [2, 3, 4]
    context.fn = this
    const res = context.fn(...arg)
    delete context.fn
    return res
  }
  
  
  let res = foo.myCall(obj, 2, 3, 4)
  console.log(res);